# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : decimal_conversion.py
# @Time     : 2024/2/19 0:43
# @Author   : Robot-Zsj
"""
description: 
"""


def func(num, n):
    str_list = []
    dic = {k: v for k, v in enumerate('0123456789ABCDEF')}
    while True:
        if num == 0:
            break
        next_num = num // n
        add_num = num % n
        str_list.insert(0, dic[add_num])
        num = next_num
    return ''.join(str_list)


print(func(8, 2))
